﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccess;
using Model;

namespace Bussiness
{
    public class ManagerClient
    {
        public static Model.Client FindClient(Model.Client clientFind)
        {
            List<Client> clients = DataAccessClient.SearchClientById(clientFind);
            if (clients.Count == 0)
            return null;
            return clients.First();
        }

        public static void RegisterOrUpdateClient(Client newClient)
        {
            if (FindClient(newClient) == null)
                DataAccessClient.InsertNewClient(newClient);
            else
                DataAccessClient.UpdateClient(newClient);
        }
    }
}
